<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<s:url value="/css/common.less"/>" type="text/less"
	rel="stylesheet" />
	<link href="<s:url value="/css/common.css"/>" type="text/css"
	rel="stylesheet" />

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.blockUI.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<style type="text/css">

.error {
	color: red;
}

</style>
<script type="text/javascript">

	$(document).ready(function() {
		//检查是什么状态，更新或新增
		var flag="${flag}";
		if(flag=="update"){
			$("#freezeMer").attr("action","<%=basePath%>/freeze/updateFreezeMer.ct");
		}
		//验证商户号长度
		jQuery.validator.addMethod("sLength", function(value,element) {
			var length = value.length;
			if(length!=15){
				return this.optional(element) || false;
			}
			return this.optional(element) || true;
		}, "商户号长度为15");
		//验证金额
		jQuery.validator.addMethod("isMoney", function(value,element) {
			var reg= /^([1-9][\d]{0,9}|0)(\.[\d]{1,2})?$/;
			if(value==0){
				return this.optional(element) || false;
			}
			if(reg.test(value)){
				return this.optional(element) || true;
			}			
			return this.optional(element) || false;
			}, "必须在0-9999999999.99之间，最多2位小数");
		// 字符最大长度验证（一个中文字符长度为2）
		jQuery.validator.addMethod("stringMaxLength", function(value,element, param) {
			var length = value.length;
			for ( var i = 0; i < value.length; i++) {
				if (value.charCodeAt(i) > 127) {
					length++;
				}
			}
			return this.optional(element) || (length <=param);
		}, $.validator.format("长度不能大于{0}!"));	
		$("#freezeMer").validate({
			debug : true,
			submitHandler : function(form) {
				$("#btnAdd").attr("disabled",true);
					form.submit();
			},
			rules : {
				"freezeBean.mchntCd":{required : true,sLength:true},
				"freezeBean.freezeAmt" : {required : true,isMoney:true},
				"freezeBean.remark":{required : true}
			},
			messages : {
				"freezeBean.mchntCd":{required : "必填"},
				"freezeBean.freezeAmt" : {required : "必填"},
				"freezeBean.remark":{required : "必填"}
			},errorPlacement: function(error, element) { 
			    if ( element.is(":radio") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is(":checkbox") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is("input") ) {
			    	error.appendTo ( element.parent() ); 
			    }
			    else 
			        error.insertAfter(element); 
			} 

		});
		
	});

</script>



</head>

<body>
			<s:form id="freezeMer" action="/freeze/addFreezeMer.ct" method="post"  theme="simple"  >
				<table width="100%" class="tb" >
			        <tr class="tb-line">
			            <td class="tb-td" colspan="6">
				            <div class="tb-h2">POS收单运营管理平台</div>
					   	</td>
			        </tr>
	                <tr class="tb-line bg-gray">
			            <td class="tb-td" colspan="4">
			            		<div class="tb-h3">
			                	<s:if test="#request.flag==\"update\"">
			                		修改冻结商户
			                		<s:hidden name="freezeBean.keyStr"></s:hidden>
			                	</s:if>
			                	<s:else>
			                		添加冻结商户
			                	</s:else>
			                	</div></td>
			        </tr>
					<tr class="tb-line">						     
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">商户号：</div>
			            </td>
			            <td class="tb-td" >				            		
			            		<s:if test="#request.flag==\"update\"">
			            			<label class="tb-input-lengthen">
			                		<s:textfield maxLength="200" name="freezeBean.mchntCd"
									cssClass="queryWidth" disabled="true"></s:textfield>
									<s:hidden name="freezeBean.mchntCd"></s:hidden>
									</label>
			                	</s:if>		             								
			                	<s:else>
			                	<label class="tb-input-lengthen">
			                		<s:textfield maxLength="200" name="freezeBean.mchntCd"
									cssClass="queryWidth"></s:textfield>
								</label>
								<font color="red">*</font>
			                	</s:else>		
						</td>
						<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">冻结总金额：</div>
			            </td>
			            <td class="tb-td" >
			            		<s:if test="#request.flag==\"update\"">
			            		<label class="tb-input-lengthen">			             									
								<s:textfield maxLength="200" name="freezeBean.freezeAmt"
									cssClass="queryWidth" id="freezeAmt" disabled="true"></s:textfield>
									</label>
									<font color="red">(单位元)</font>
								</s:if>
								<s:else>
								<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="freezeBean.freezeAmt"
									cssClass="queryWidth" id="freezeAmt"></s:textfield>
								</label>
								<font color="red">(单位元)</font>
								</s:else>
						</td>
						</tr>
						<s:if test="#request.flag==\"update\""><!--修改 -->
						<tr class="tb-line">				    						     
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">已冻结金额：</div>
			            </td>
			            <td class="tb-td" >				            		
		             			<label class="tb-input-lengthen">						
								<s:textfield maxLength="200" name="freezeBean.freezeHadSum"
									cssClass="queryWidth" disabled="true"></s:textfield>
								</label>
								<font color="red">(单位元)</font>
						</td>
						<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">未冻结总金额：</div>
			            </td>
			            <td class="tb-td" >
			            		<label class="tb-input-lengthen">						
								<s:textfield maxLength="200" name="freezeBean.freezeWeiSum"
									cssClass="queryWidth" disabled="true"></s:textfield>
								</label>
								<font color="red">(单位元)</font>
						</td>
						</tr>
						</s:if>
						<tr class="tb-line">					
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">原调单流水：</div>
			            </td>
			            <td class="tb-td" >
			            		<s:if test="#request.flag==\"update\"">
			            		<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="freezeBean.oldTransKey"
									cssClass="queryWidth" disabled="true"></s:textfield>
								</label>
			            		</s:if>	
			            		<s:else>		             									
								<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="freezeBean.oldTransKey"
									cssClass="queryWidth"></s:textfield>
								</label>
								</s:else>
						</td>
						<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">交易卡号：</div>
			            </td>
			            <td class="tb-td" >
			            		<s:if test="#request.flag==\"update\"">
			            		<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="freezeBean.oldTransCardNo"
									cssClass="queryWidth" disabled="true"></s:textfield>
								</label>
			            		</s:if>
			            		<s:else>			             									
								<label class="tb-input-lengthen">
			             		<s:textfield maxLength="200" name="freezeBean.oldTransCardNo"
									cssClass="queryWidth"></s:textfield>
								</label>
								</s:else>								
						</td>
						</tr>
					<s:if test="#request.flag==\"update\"">
					<tr class="tb-line">
			        <td align="right" class="tb-td" style="width:110px;">
                	<div class="tb-h4" id="title">冻结启用状态：</div>
            		</td>
					<td class="tb-td">
                	<label>
						<s:radio name="freezeBean.useStatus" list="#{'0':'未启用','1':'已启用'}" cssClass="queryWidth" /> 
					</label>
					</td>
					
					<td align="right" class="tb-td" style="width:110px;">
                	<div class="tb-h4">是否已冻结满：</div>
            		</td>
					<td class="tb-td">
                	<label>
						<s:radio name="freezeBean.freezeFlag" list="#{'0':'未冻满','1':'已冻满'}" disabled="true" cssClass="queryWidth"/> 
					</label>
					</td>               								
					</tr>
					</s:if>	
						<tr class="tb-line">					
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">备注：</div>
			            </td>
			            <td class="tb-td" colspan="3" style="height:auto;line-height:auto;" >
			             	<label style="height:auto;line-height:auto;">
			             		<s:textarea rows="5" cssClass="someWidth" 
								name="freezeBean.remark" maxlength="200"  style="height: 102px; resize: none; width: 530px;padding:0 5px;" />
			             	</label>
			             	<font color="red">*</font>
			             </td>
						</tr>				   					
				</table>		
		      <table width="100%" border="0" cellspacing="0" class="table">
		           	<tr class="tb-line">
						<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
							<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
					<tr class="tb-line">
			            <td class="tb-td line-submit" align="center" colspan="4">
			                <label class="tb-input-submit">		                
			                	<s:submit id="btnAdd" value="保  存" />								
							</label>
			                <label class="tb-input-submit">
								<input type="reset" value="取  消"/>
							</label>
							<label class="tb-input-submit">
								<input type="button" value="返回" onclick="history.back()"/>
							</label>
						</td>
					</tr>
            </table>
			</s:form>	
</body>
</html>
